﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SASystem
{
    public partial class LoginFrm : Form
    {
        private bool m_bIsLogin;
        private int m_CheckPower;
        public LoginFrm()
        {
            InitializeComponent();
            m_bIsLogin = false;

            //this.textBox_serverName.Text = SABLL.GetRemoteServer();
        }

        private void button_login_Click(object sender, EventArgs e)
        {
            //m_bIsLogin = SABLL.SetRemoteServer(this.textBox_serverName.Text);
            m_bIsLogin = SABLL.ValidateUser(this.textBox_userName.Text,this.textBox_password.Text);

            if (m_bIsLogin)
            {
                m_CheckPower = SABLL.checkUserAuthority(this.textBox_userName.Text);
                this.Close();
            }
            else
            {
                SABLL.DoAlert();
            }
        }

        public bool Success()
        {
            return m_bIsLogin;
        }


        public int CheckPower()
        {
            return m_CheckPower;
        }

        public string UserName()
        {
            return this.textBox_userName.Text;
        }

        private void button_cancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
